Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body onload="myFunction()"> <input type="file" id="myFile" multiple size="50" onchange="myFunction()"> <p id="demo"></p> <script> function myFunction(){ var x = document.getElementById("myFile"); var txt = ""; if ('files' in myFile) { if (x.files.length == 0) { txt = "Select one or more files."; } else { for (var i = 0; i < x.files.length; i++) { txt += "<br><strong>" + (i+1) + ". file</strong><br>"; var file = x.files[i]; if ('name' in file) { txt += "name: " + file.name + "<br>"; } if ('size' in file) { txt += "size: " + file.size + " bytes <br>"; } } } } else { if (x.value == "") { txt += "Select one or more files."; } else { txt += "The files property is not supported by your browser!"; txt += "<br>The path of the selected file: " + x.value; // If the browser does not support the files property, it will return the path of the selected file instead. } } document.getElementById("demo").innerHTML = txt; } </script> <p><strong>Tip:</strong> Use the Control or the Shift key to select multiple files.</p> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_fileupload_files by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:32:58 GMT --> </html>
Result:
Try it Yourself - © w3schools.com